package server.java.autoduel.Util;

import java.io.File;
import java.io.FileFilter;

/**
 * Utility class for making sure the factories only detect xml files when
 * loading from the data directory
 * 
 * @author Ian Axelrod
 * @author Liz Ha
 * @author Andrew Muldowney
 * @author Edward Futch
 */
public class XmlFileFilter implements FileFilter {

	/**
	 * A list of valid file extensions for this filter
	 */
	private final String[] validExts = new String[] { "xml" };

	@Override
	public boolean accept(File file) {
		for (final String ext : this.validExts) {
			if (file.getName().toLowerCase().endsWith(ext)) {
				return true;
			}
		}
		return false;
	}
}